package org.icosagon.core.magic;

import org.icosagon.core.Modifiable;
import org.icosagon.core.math.Equation;

/**
 *
 * @author Daniel Owens
 */
public class Effect {
    private Modifiable effected = null;
    private Equation value = null;
    private boolean duration_stackable = false;
    private boolean change_stackable = true;
    private Equation duration = null;
    private String description = "";
    private String type = "";

    public Effect(String desc) {
        this.setDescription(desc);
    }
    
    public Effect(Modifiable feature, Equation change) {
        this.effected = feature;
        this.value = change;
    }

    public void setChange(Modifiable change) {
        this.effected = change;
    }
    
    public Modifiable getChange() {
        return this.effected;
    }
    
    public Equation getValue() {
        return this.value;
    }
    
    public void setDurationStackable(boolean value) {
        this.duration_stackable = value;
    }
    
    public boolean isDurationStackable() {
        return this.duration_stackable;
    }

    public void setChangeStackable(boolean value) {
        this.change_stackable = value;
    }

    public boolean isChangeStackable() {
        return this.change_stackable;
    }

    public void setDuration(Equation value) {
        this.duration = value;
    }

    public Equation getDuration() {
        return this.duration;
    }

    public void setDescription(String desc) {
        this.description = desc;
    }

    public String getDescription() {
        return this.description;
    }

    public void setType(String value) {
        this.type = value.trim().toLowerCase();
    }

    public String getType() {
        return this.type;
    }

    @Override
    public int hashCode() {
        return Math.abs(this.effected.getName().hashCode()+this.description.hashCode()-this.value.hashCode()+new Boolean(this.change_stackable).hashCode()-new Boolean(this.duration_stackable).hashCode());
    }
}